class CreateLessons < ActiveRecord::Migration
  def self.up
    create_table :lessons do |t|
      t.date :applied_at, :null => false
      t.string :title, :limit => 100, :null => false
      t.text :description, :null => false
      t.references :course, :null => false
      t.references :didatic_material
      t.references :task

      t.timestamps
    end
    add_index(:lessons, [:title,:applied_at,:course_id], :unique => true, :name => "uk_lesson_date_course")
  end

  def self.down
    drop_table :lessons
  end
end
